
#include <GL/glut.h>
#include <GL/gl.h>

#ifndef CALYPSO_OBJECT_HPP
#define CALYPSO_OBJECT_HPP

namespace calypso {

	class Object {
	protected:
		float x, y, z;
		float scale;

	public:
		Object (float _scale) 
			: x (0.0f), y (0.0f), z (0.0f), scale (_scale) {
		}

		void translate (float _x, float _y, float _z) {
			x += _x;
			y += _y;
			z += _z;
		}

		void resize (float _scale) {
			scale = _scale;
		}

		void push () {
			glPushMatrix ();
			glTranslatef (x, y, z);
		}

		void pop () {
			glPopMatrix ();
		}

		void render () {
			push ();
			draw ();
			pop ();
		}

		virtual void draw () = 0;
	};

	class Teapot : public Object {
	public:
		Teapot (float _scale) : Object (_scale) {}

		virtual void draw () {
			glutSolidTeapot (scale);
		}
	};

	class Torus : public Object {
	private:
		float innerRadius;

	public:
		Torus (float _scale, float _innerRadius) :
		       Object (_scale), innerRadius (_innerRadius) {
		}

		virtual void draw () {
			glutSolidTorus (innerRadius, scale, 10, 30);
		}
	};
}

#endif
